import {defineStore} from 'pinia'

export const useChattingStore = defineStore('chatting', {
    state: () => {
        return {
            type: null,
            customId: null,
            customName: '',
            fileId: null,
            fileName: '',
            prompt: '',
            chattingList: [],
        }
    },
    getters: {},
    actions: {
        connetChat(data) {
            this.type = data.type
            this.customId = data.id
            this.customName = data.title
            this.fileId = data.fileId
            this.fileName = data.fileName
            this.prompt = data.prompt
        },

        addChat(data) {
            this.chattingList.push(data)
        },

        switchChat(data) {
            this.chattingList = [...data]
        },

        clearChat() {
            this.chattingList = []
        }
    },
})